<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>JS10.html</title>

		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="this is my page">
		<meta http-equiv="content-type" content="text/html; charset=UTF-8">


		<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
		<script type="text/javascript">

//定义属性的两种方式
/*var object = new Object();

 object.name = "kevin";
 object["age"] = 25;
 alert(object.name);
 alert(object.age);
 object.setName = function(name) {
 this.name = name;
 alert(object.name);
 }*/
//alert("hello");
//对象可以动态增加属性，也可以动态删除属性
//object.id = 1;
//alert(object.id);
//删除Object的属性的值
//delete object.name;
//定义对象的最常用方式	
/*var object2 = {
 name : "annie",
 age : 25
 };*/
/*
 alert(object2.name);*/

//数组排序
/*var array = new Array();

 array.push(1);
 array.push(23);
 array.push(5);
 array.push(35);

 function sortNum(num1, num2) {
 var n1 = parseInt(num1);
 var n2 = parseInt(num2);

 return n1 - n2;
 }

 array.sort(sortNum);

 for ( var i in array) {
 alert(array[i]);
 }*/

//用工厂方式创建 对象
/*function createObject() {
	var object = new Object();

	object.name = "kevin";
	object.age = 25;

	object.getObject = function() {
		alert(this.name + ":" + this.age);
	}

	return object;
}

var object1 = createObject();
var object2 = createObject();

object1.name = "kevin";
object2.name = "annie";

object1.getObject();
object2.getObject();*/


function Parent(username){
	this.username = username;
	
	this.sayHello = fucnction(){
		alert(this.username);
	};
}

function Child(username,password)
{
	Parent(username);
}

var c1 = new Child("kevin",123);
alert(c1.username);

</script>

	</head>

	<body>
	</body>
</html>
